home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 2.iso / programr / rsxwdk2s.zip / RSXWDK / LIBSRC / SYSDJ / SYSTEM.C < prev    next >
C/C++ Source or Header  |  1994-10-19  |  437b  |  29 lines

  1. #include <errno.h>
  2. #include <string.h>
  3.  
  4. extern unsigned short WinExec(char *, unsigned);
  5.  
  6. #define MAX_EXEC_CHARS 120
  7.  
  8. int system(const char *buf)
  9. {
  10.     int ret, len;
  11.  
  12.     len = strlen(buf);
  13.  
  14.     /* only 120 chars allowed (Win 3.1) */
  15.     if (len  >= MAX_EXEC_CHARS) {
  16.     errno = E2BIG;
  17.     return -1;
  18.     }
  19.  
  20.     ret = WinExec(buf, 1);
  21.  
  22.     if (ret <= 32) {
  23.     errno = EINVAL;
  24.     return -1;
  25.     }
  26.     else
  27.     return 0;
  28. }
  29.